const path = require("path");

module.exports = function config(loaderContext) {
  // 独立分包
  const isSubIndependent = /sub_independent[/\\](?:\w+[/\\])*\w+\.less$/.test(
    loaderContext.file
  );
  if (isSubIndependent && process.env.TARO_ENV === "weapp") {
    return {
      plugins: {
        tailwindcss: {
          config: path.resolve(__dirname, "tailwind.config.sub_independent.js"),
        },
        autoprefixer: {},
      },
    };
  }
  return {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  };
};
